{layout  name="public:layout" /}
<style>
    .which_group {
        list-style:none;
        margin:0;
        padding:0;
        width:100%;
        font-size:11px;
        color:#595959;
    }
    .which_group li {
        float:left;
        list-style:none;
        padding:7px;
        cursor:pointer;
        box-Shadow:1px 2px 3px #D9D9D9;
    }
    .which_group li:first-child {
        border-top-left-radius:3px;
        border-bottom-left-radius:3px;
    }
    .which_group li:last-child {
        border-top-right-radius:3px;
        border-bottom-right-radius:3px;
    }

</style>

<div class="content">

    <div class="header">

        <h1 class="page-title">后台参数设置</h1>
    </div>

    <ul class="breadcrumb">
        <li><a href="#">基本设置</a> <span class="divider">/</span></li>

      
        <li class="active">后台参数设置</li>
    </ul>

    <div class="container-fluid">
        <div class="row-fluid">

            <div class="btn-toolbar">
                &nbsp;
                <!--                <a href="#myModal" data-toggle="modal1" class="btn">Delete</a>-->
                <div class="btn-group">
                </div>
            </div>
            <div class="well" style="margin-top: -15px;">
                <!--                <ul class="nav nav-tabs">
                                    <li class="active"><a href="#home" data-toggle="tab">个人信息</a></li>
                                    <li><a href="#profile" data-toggle="tab">修改密码</a></li>
                                </ul>-->
                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane active in" id="home">
                        <form id="form" name="form" method="post" enctype="multipart/form-data" onsubmit="return false">
                            <input type="hidden" name="check" value="{$list.is_check}">


                            <label>网站名称：</label>
                            <input  name="name" type="text" value="{$list.name}" class="input-xlarge" style="width: 200px;">
                            <label>网站LOGO：</label>
                            <div id="photo_info">

                                <img src="/static/config/{if condition="$list['logo']==''"}default.gif{else/}{$list.logo}{/if}" style="width:80px;height: 80px;">
                            </div>
                            <input  name="logo" type="file" value="" class="input-xlarge" style="cursor: pointer;margin-top: -100px;margin-left: -100px;opacity: 0" onchange="PreviewImage(this)">
                            <label>是否开启登录验证码：</label>

                            <div>
                                <ul class="which_group" id="routeType">
                                    <li id="routeType_1" value="1" onclick="checkrouteType(1)">&nbsp;开启 &nbsp;</li>
                                    <li id="routeType_2" value="2" onclick="checkrouteType(2)">&nbsp;关闭 &nbsp;</li>
                                </ul>
                            </div>
                            <input type="hidden" name="is_check" value="{$list.is_check}">
                            <br>
                            <br>
                            <div style="margin-top: 20px;">
                                <button class="btn btn-primary save1"><i class="icon-save"></i> 保存</button>
                            </div>
                        </form>
                        <script>
                            //执行一个laydate实例
                            laydate.render({
                                elem: '#test1' //指定元素
                                , type: 'datetime'

                            });

                            var check = $("[name=check]").val();
                            if (check == 2)
                            {
                                $("#routeType_2").css("background-color", "#05A5F9");
                                $("#routeType_2").css("color", "#FFFFFF");
                            } else
                            {
                                //单选二
                                //var planeTime = "0"; //默认value值
                                $("#routeType_1").css("background-color", "#05A5F9");
                                $("#routeType_1").css("color", "#FFFFFF");
                            }

                            function checkrouteType(id) {
                                //alert(id);
                                distanceType = $("#routeType_" + id)[0].attributes.value.nodeValue;
                                $("#routeType li").css("background-color", "rgba(255,255,255,0)");
                                $("#routeType li").css("color", "#595959");
                                $("#routeType_" + id).css("background-color", "#05A5F9");
                                $("#routeType_" + id).css("color", "#FFFFFF");
                                $("[name=is_check]").val(id);
                            }
                        </script>

                        <script>
                            $(".save1").click(function () {
                                var formData = new FormData(document.getElementById("form"));//表单id
                                $.ajax({
                                    type: "post",
                                    url: "{:url('admin/Config/updateconfig')}",
                                    data: formData,
                                    async: false,
                                    cache: false,
                                    contentType: false,
                                    processData: false,
                                    dataType: 'json',
                                    success: function (data) {
                                        //alert(data);
                                        if (data.status !== 1)
                                        {
                                            layer.load(1, {
                                                shade: [0.1, ''], //0.1透明度的白色背景
                                                time: 500
                                            });
                                            setTimeout(function () {
                                                layer.msg(data.message, {time: 1000}, function () {
                                                });
                                            }, 500);

                                        } else
                                        {
                                            //
                                            layer.load(1, {
                                                shade: [0.1, ''], //0.1透明度的白色背景
                                                time: 500
                                            });
                                            setTimeout(function () {
                                                layer.msg(data.message, {time: 1000});
                                            }, 500);
                                        }
                                    }
                                })
                            })
                        </script>
                        <script  type="text/javascript">
                            function PreviewImage(imgFile) {
                                var filextension = imgFile.value.substring(imgFile.value
                                        .lastIndexOf("."), imgFile.value.length);
                                filextension = filextension.toLowerCase();
                                if ((filextension != '.jpg') && (filextension != '.gif')
                                        && (filextension != '.jpeg') && (filextension != '.png')
                                        && (filextension != '.bmp')) {
                                    alert("对不起，系统仅支持标准格式的照片，请您调整格式后重新上传，谢谢 !");
                                    imgFile.focus();
                                } else {
                                    var path;

                                    if (document.all)//IE
                                    {
                                        imgFile.select();
                                        path = document.selection.createRange().text;



                                        document.getElementById("photo_info").innerHTML = "";
                                        document.getElementById("photo_info").style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='scale',src=\""
                                                + path + "\")"; //使用滤镜效果
                                    } else//FF
                                    {
                                        path = window.URL.createObjectURL(imgFile.files[0]); // FF 7.0以上

                                        var file = imgFile.files[0];
                                        var reader = new FileReader();
                                        reader.readAsDataURL(file);
                                        reader.onload = function (e) {    //成功读取文件
                                            var img = document.getElementById("selectImg");
                                            img.src = e.target.result;   //或 img.src = this.result / e.target == this

//                        alert(img.src);


                                        };
                                        //alert(path);
//                    $("[name=img2]").val(path);
                                        //path = imgFile.files[0].getAsDataURL();// FF 3.0
                                        document.getElementById("photo_info").innerHTML = "<img id='img' src='" + path + "' style='width:80px;height:80px;'/>";
                                        //document.getElementById("img1").src = path;
                                    }
                                }
                            }
                        </script>
                    </div>

                </div>

            </div>
            <footer>
                <hr>

                <p class="pull-right">Collect from <a href="#" title="网页模板" >sxddd</a></p>


                <p>&copy; 2019 <a href="#" >Portnine</a></p>
            </footer>

        </div>
    </div>

</div>